import axios from 'axios'
import config from '../config'
import $ from 'jquery'
import qs from 'qs'

export default {
  // 通用网络请求方法
  request (uri, data = {}, method = 'post', header = {}) {
    const url = config.serverURI + uri;
    const defaultData = {
      'REQTIME': Date.now()
    };
    data = qs.stringify($.extend(defaultData,data));
    const defaultHeader = {
      'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
    };
    header = $.extend(defaultHeader,header);
    return axios({
      method : method,
      url : url,
      data : data,
      headers: header
    })
  },
  login(modal){
    return this.request('/app/v2/wfollowup',modal);
  }
}
